perm filename LSPP19.F77[206,LSP] blob
sn#305211 filedate 1978-02-10 generic text, type T, neo UTF8
/LMAR=0/XLINE=3/FONT#0=BAXL30/FONT#1=BAXM30/FONT#2=BAXB30/FONT#3=SUB/FONT#4=SUP/FONT#5=NGR25/FONT#6=NGR20/FONT#7=MATH30/FONT#9=GRK30/FONT#10=MS25/FONT#11=GRFX25/FONT#12=GRFX35
␈↓ ↓H␈↓␈↓ ¬oCHAPTER I␈↓ *19
␈↓ ↓H␈↓Suppose␈αwe␈αwant␈α
to␈αform␈αa␈αnew␈α
list␈αfrom␈αan␈αold␈α
one␈αby␈αapplying␈αa␈α
function␈α ␈↓↓f␈↓␈α to␈α
each␈αelement
␈↓ ↓H␈↓of the list. This can be done using the function ␈↓↓mapcar␈↓ defined by
␈↓ ↓H␈↓␈↓ βV␈↓↓mapcar[x, f] ← ␈↓αif␈↓↓ ␈↓αn␈↓↓␈α∧x ␈↓αthen␈↓↓ ␈↓¬NIL␈↓↓ ␈↓αelse␈↓↓ f[␈↓αa␈↓↓␈α∧x] . mapcar[␈↓αd␈↓↓␈α∧x, f]␈↓.
␈↓ ↓H␈↓Such␈α∂a␈α∂function␈α∂is␈α∂called␈α∂a␈α∂␈↓↓functional.␈↓␈α∂ It␈α∂can␈α∂be␈α∂viewed␈α∂as␈α∂mapping␈α∂a␈α∂function␈α∂into␈α∞another
␈↓ ↓H␈↓function.␈α Suppose␈αthe␈αoperation␈αwe␈αwant␈αto␈αperform␈αis␈αsquaring,␈αand␈αwe␈αwant␈α to␈αapply␈αit␈αto␈αthe
␈↓ ↓H␈↓list ␈↓¬(1 2 3 4 5 6 7)␈↓. We have
␈↓ ↓H␈↓␈↓ βi␈↓↓mapcar[␈↓¬(1 2 3 4 5 6 7)␈↓↓, λx: x␈↓∧2␈↓↓] = ␈↓¬(1 4 9 16 25 36 49)␈↓↓␈↓.
␈↓ ↓H␈↓ A␈α⊃more␈α⊃generally␈α⊃useful␈α⊃operation␈α⊃than␈α⊃ ␈↓↓mapcar␈↓␈α⊃is␈α⊃␈↓↓maplist␈↓␈α⊃in␈α⊃ which␈α⊃ the␈α⊃ function␈α⊂is
␈↓ ↓H␈↓applied to the successive sublists of the list rather than to the elements. ␈↓↓maplist␈↓ is defined by
␈↓ ↓H␈↓␈↓ β\␈↓↓maplist[x, f] ← ␈↓αif␈↓↓ ␈↓αn␈↓↓␈α∧x ␈↓αthen␈↓↓ ␈↓¬NIL␈↓↓ ␈↓αelse␈↓↓ f[x] . maplist[␈↓αd␈↓↓␈α∧x, f]␈↓.
␈↓ ↓H␈↓ As␈α
an␈α
application␈α
of␈α
␈↓↓maplist␈↓␈α
and␈αfunctional␈α
arguments,␈α
we␈α
shall␈α
define␈α
a␈α
function␈α for
␈↓ ↓H␈↓differentiating␈α algebraic␈α
expressions␈αinvolving␈α
sums␈αand␈α
products.␈α The␈α
expressions␈αare␈αbuilt␈α
up
␈↓ ↓H␈↓from atoms denoting variables and integer constants according to the syntax
␈↓ ↓H␈↓ <expression> ::= <variable> | <integer> | (PLUS <explist>) | (TIMES <explist>)
␈↓ ↓H␈↓ <explist> ::= <expression> | <expression><explist>
␈↓ ↓H␈↓Here,␈α⊂ ␈↓¬PLUS␈↓␈α⊂ followed␈α∂by␈α⊂a␈α⊂list␈α∂of␈α⊂arguments␈α⊂denotes␈α∂the␈α⊂sum␈α⊂of␈α∂these␈α⊂arguments␈α⊂and␈α∂ ␈↓¬TIMES␈↓
␈↓ ↓H␈↓followed␈α∂by␈α⊂a␈α∂list␈α⊂of␈α∂arguments␈α⊂ denotes␈α∂ their␈α⊂product.␈α∂ The␈α⊂ function␈α∂ ␈↓↓diff[e, v]␈↓␈α⊂ gives␈α∂the
␈↓ ↓H␈↓partial derivative of the expression ␈↓↓e␈↓ with respect to the variable ␈↓↓v.␈↓ We have
␈↓ ↓H␈↓ ␈↓↓diff[e, v] ← ␈↓αif␈↓↓ ␈↓αat␈↓↓␈αεe ␈↓αthen␈↓↓ [␈↓αif␈↓↓ e ␈↓αeq␈↓↓ v ␈↓αthen␈↓↓ 1 ␈↓αelse␈↓↓ 0]␈↓
␈↓ ↓H␈↓ ␈↓↓␈↓αelse␈↓↓ ␈↓αif␈↓↓ ␈↓αa␈↓↓␈α∧e ␈↓αeq␈↓↓ ␈↓¬PLUS ␈↓↓␈↓αthen␈↓↓ ␈↓¬PLUS ␈↓↓. mapcar[␈↓αd␈↓↓␈α∧e, λx: diff[x, v] ]␈↓
␈↓ ↓H␈↓ ␈↓↓␈↓αelse␈↓↓ ␈↓αif␈↓↓ ␈↓αa␈↓↓␈α∧e ␈↓αeq␈↓↓ ␈↓¬TIMES ␈↓↓␈↓αthen␈↓↓ ␈↓¬PLUS ␈↓↓. maplist[␈↓αd␈↓↓␈α∧e,␈↓
␈↓ ↓H␈↓ ␈↓↓λx: ␈↓¬TIMES ␈↓↓. maplist[␈↓αd␈↓↓␈α∧e, λy: ␈↓αif␈↓↓ x ␈↓αeq␈↓↓ y ␈↓αthen␈↓↓ diff[␈↓αa␈↓↓␈α∧y, v] ␈↓αelse␈↓↓ ␈↓αa␈↓↓␈α∧y]]␈↓.
␈↓ ↓H␈↓The term that describes the rule for differentiating products corresponds to the rule
␈↓ ↓H␈↓␈↓ ∧ ␈↓↓∂/∂v[␈↓ P␈↓↓␈↓βi␈↓↓ e␈↓βi␈↓↓] = ␈↓ S␈↓↓␈↓βi␈↓↓␈↓ P␈↓↓␈↓βj␈↓↓ [␈↓αif␈↓↓ i=j ␈↓αthen␈↓↓ ∂e␈↓βj␈↓↓/∂v ␈↓αelse␈↓↓ e␈↓βj␈↓↓] .␈↓
␈↓ ↓H␈↓and␈α ␈↓↓maplist␈↓␈α has␈α to␈αbe␈α
used␈αrather␈αthan␈α ␈↓↓mapcar␈↓␈α since␈α
whether␈αto␈αdifferentiate␈αin␈αforming␈α
the
␈↓ ↓H␈↓product␈α
is␈α
determined␈α
by␈α
equality␈α
of␈α
the␈α
indices␈α ␈↓↓i␈↓␈α
and␈α
␈↓↓j␈↓␈α
rather␈α
than␈α
equality␈α
of␈α
the␈αterms␈α
␈↓↓e␈↓βi␈↓
␈↓ ↓H␈↓and ␈↓↓e␈↓βj␈↓.
␈↓ ↓H␈↓ Two␈αadditional␈α
useful␈αfunctions␈α
with␈αfunctions␈α
as␈αarguments␈α
are␈αthe␈α
predicates␈α ␈↓↓andlis␈↓␈α
and
␈↓ ↓H␈↓␈↓↓orlis␈↓ defined by the equations
␈↓ ↓H␈↓␈↓ ∧)␈↓↓andlis[u, p] ← ␈↓αn␈↓↓␈α∧u ∨ [p[␈↓αa␈↓↓␈α∧u] ∧ andlis[␈↓αd␈↓↓␈α∧u, p]]␈↓
␈↓ ↓H␈↓and